package mammuthus.command

import mammuthus.slave.{ShellCommand, InteractiveShellCommand}
import mammuthus.tool.TemplateTool

/**
 * 5/13/15 WilliamZhu(allwefantasy@gmail.com)
 */
class PortMonitorExplain {
  var portInfo: PortInfo = _

  def apply(port:Int) = {
//   val tcpDump = TemplateTool.render(s"/template/command/shell/port_monitor.vm", Map(
//     "port" -> s"$port"
//   ))
//   ShellCommand.
  }

  def explain(tcpDumpStr: String) = {
     tcpDumpStr.split("\\s+")
  }
}

/*
21:08:02.470789 IP 117.79.93.209.http > 121.199.13.251.50194: Flags [F.], seq 744084235, ack 3575140204, win 14, options [nop,nop,TS val 3003728121 ecr 3832812138], length 0
21:08:02.485292 IP 119.165.236.181.radio > 117.79.93.201.http: Flags [S], seq 1947441931, win 65535, options [mss 1440,nop,wscale 1,nop,nop,sackOK], length 0
21:08:02.686158 IP 183.61.24.152.46887 > 117.79.93.201.http: Flags [S], seq 690419912, win 8192, options [mss 1440,nop,wscale 2,nop,nop,sackOK], length 0
21:08:02.714047 IP 124.72.58.121.51285 > 117.79.93.201.http: Flags [S], seq 340276044, win 8192, options [mss 1440,nop,wscale 2,nop,nop,sackOK], length 0
 */
case class PortInfo(
                     connectedTime: String,
                     sourceIp: String, sourcePort: String,
                     targetIp: String, targetPort: String
                     )
